<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/sys/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<%@ include file="/WEB-INF/adminui/include/css.jsp" %>
<title>用户列表</title>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox">
				<div class="ibox-body">
					<div class="fixed-table-toolbar">
						<div id="toolbar" class="columns pull-left">
							<button type="button" class="btn btn-primary" onclick="add()">
								<i class="fa fa-plus hidden" aria-hidden="true"></i>添加
							</button>
							<!-- <button type="button" class="btn btn-danger" onclick="del()">
								<i class="fa fa-trash hidden" aria-hidden="true"></i>删除
							</button> -->
						</div>
						<div class="columns pull-right">
							<button class="btn btn-success" onclick="UiList.loadTable()">查询</button>
						</div>
						<div class="columns pull-right col-md-2 nopadding">
							<input id="searchName" type="text" class="form-control" placeholder="按账号搜索">
						</div>
					</div>
					<table id="dataTable" data-mobile-responsive="true">
					</table>
				</div>
			</div>
		</div>
	</div>
</div>
<%@ include file="/WEB-INF/adminui/include/script.jsp" %>
<script type="text/javascript">
$(function(){
	UiList.render({
		tableConfig:{
			url: "${path}/wxuser/listdata.json",
			idfield: 'wxuserid',
			columns: [
				{checkbox : true},
				{field : 'loginName', title : '账号'},
				{field : 'username', title : '姓名'},
				{field : 'nickname', title : '昵称'},
				{field : 'phone', title : '手机'},
				{field : 'sex', title : '性别'},
				{field : 'birth', title : '出生日期', formatter : function(value, row, index) {
					return formatDate(value, 'yyyy-MM-dd');
				}},
				{field : 'wxuserid', title : '操作', align : 'center', formatter : function(value, row, index) {
					var s = '';
					s += '<a class="btn btn-primary btn-sm" href="javascript:;" title="修改用户信息" onclick="edit(\''+value+'\')">修改</a> ';
					s += '<a class="btn btn-warning btn-sm" href="javascript:;" title="重置用户密码" onclick="resetPassword(\''+value+'\')">重置密码</a> ';
					s += '<a class="btn btn-danger btn-sm" href="javascript:;" title="会员卡" onclick="listcard(\''+value+'\')">会员卡</a> ';
					s += '<a class="btn btn-primary btn-sm" href="javascript:;" title="查看消费记录" onclick="consumelog(\''+value+'\')">消费记录</a> ';
					return s;
				}}
			]
		},
		tableParams: function(){//搜索条件
			return {search: $("#searchName").val()};
		}
	});
	
});

function add(){
	UiList.open('${path}/wxuser/add.do', '添加用户信息', {full:true});
}
function del(){
	UiList.dialog('${path}/wxuser/delete.json', '您确定要删除选中的用户信息吗？', '删除用户信息成功.');
}
function edit(id){
	UiList.open('${path}/wxuser/edit.do?wxuserid='+id, '修改用户信息', {full:true});
}
function resetPassword(id){
	UiList.dialog('${path}/wxuser/resetPassword.json?wxuserid='+id, '您确定要重置该用户的密码吗？', '重置密码成功.', {useTableData:false});
}
function listcard(id){
	UiList.open('${path}/member/listcard.do?wxuserid='+id, '会员卡', {full:true});
}
function consumelog(id){
	UiList.open('${path}/consumeLogs/listwxuserlogs.do?wxuserid='+id, '查看消费记录', {full:true});
}
</script>
</body>
</html>